import { WeaSearchGroup, WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaTableEditable, WeaSelect } from 'ecCom';
import { Row, Col } from 'antd';
import { toJS } from "mobx"
import { WeaSwitch } from "comsMobx"
import { observer } from 'mobx-react';
import WeaPrjFieldSetTableEdit from "../comp/weaPrjFieldSetTableEdit";

const getLabel = WeaLocaleProvider.getLabel;

@observer
export default class WbsFieldSet extends React.Component {
    constructor(props) {
        super(props);
    }
    
    getCircle() {
        let style = {
            height: 30,
            textAlign: 'center',
        }
        return style;
    }
    render() {
        const { wbsStore } = this.props;
        const { columns,columnDatas} = this.props.wbsStore;
        return (<div>
            <WeaPrjFieldSetTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaPrjFieldSetTableEdit@v5s3a6`}
                contentStore={wbsStore}
                showGroup={true}
                columns={toJS(columns)}
                datas={toJS(columnDatas)}
                onChange={this.onChange}
                ref={el => {this.wbsFieldSet = el}}
                rowKey={"groupid"}
                needAdd={true}
                needCopy={false}
                onRowSelect={this.onRowSelect}
                getRowSelection={this.getRowSelection}
            />
        </div>);
    }

    onRowSelect = (selectedKey) => {
        const {wbsStore} = this.props;
        wbsStore.setSelectRowKeys(selectedKey);
    }

    onChange=(datas)=>{
        const {wbsStore} = this.props;
        const {setColumnDatas} = wbsStore;
        setColumnDatas(datas);
    }

    getRowSelection = (rowSelection) => {
        let sel = { ...rowSelection };
        sel.getCheckboxProps = (record) => {
            return { disabled: record.canDel == 'n' };
        }
        return sel;
    }

}